package bank;

import javax.management.MBeanAttributeInfo;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Atm extends JFrame {
    private Image backImg = Util.getImage("/images/background.jpg");
    private Login login=new Login(this);
    private Menu menu=new Menu(this);
    private SaveMoney saveMoney=new SaveMoney(this);
    private GetMoney getMoney=new GetMoney(this);
    private FindMoney findMoney=new FindMoney(this);
    CardLayout cardLayout=new CardLayout();

public Atm(){
    this.setContentPane(new JPanel(){
        @Override
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(backImg,0,0,1000,800,this);
        }
    });
    this.setLayout(cardLayout);



    this.add("login",login);
    this.add("menu",menu);
this.add("saveMoney",saveMoney);
this.add("getMoney",getMoney);
this.add("findMoney",findMoney);






    this.setSize(1000, 800);
    this.setTitle("中国银行ATM机");
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}
    public void switchPanel(String name){

        cardLayout.show(this.getContentPane(),name);
    }



    public static void main(String[] args) {
        new Atm();
    }

}
